package com.airclick.merchant.repository;

import com.airclick.merchant.entity.Commercial;
import com.airclick.merchant.service.CommercialService;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;
import java.util.Optional;

public interface CommercialRepository extends JpaRepository<Commercial, String>, JpaSpecificationExecutor {


    @Modifying
    @Query(value = "update t_commercial set logo=?1,contact_address = ?2,contact_number=?3,electronic_mail=?4 , merchant_name = ?6 where id =?5 ",nativeQuery = true)
    int accountInformation(String logo, String contactAddress, String contactNumber, String electronicMail ,String id ,String merchantName);

    Commercial findAllById(String merchantId);

    List<Commercial> findAllByUserId (String id);

    @Modifying
    @Query(value = "update t_commercial set wallet_id = ?2 where id = ?1",nativeQuery = true)
    int update(String id, String walletId);

}
